﻿using GBlog.Core.Entities;
using System.Data.Entity.ModelConfiguration;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
namespace GBlog.Core.Mapping
{
    public abstract class MapBase<T, K> : EntityTypeConfiguration<T>
        where T : EntityBase<K>
        where K : struct
    {
        protected void RegisterDefault()
        {
            Property(t => t.Created).IsRequired();
        }

        protected void RegisterID()
        {
            HasKey(p => p.ID).Property(p => p.ID).HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
        }
    }
}